<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
request.setCharacterEncoding("UTF-8");
String htmlData = request.getParameter("content") != null ? request.getParameter("content") : "";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="kindeditor/themes/default/default.css" />
<link rel="stylesheet" href="kindeditor/plugins/code/prettify.css" />
<link rel="stylesheet" href="css/base.css" />

<style type="text/css">
  body { font: 18px "宋体", Arial, Helvetica, sans-serif; color: #756F71;background-color : #F7FFE8; }
</style>

<script charset="utf-8" src="kindeditor/kindeditor.js"></script>
<script charset="utf-8" src="kindeditor/lang/zh_CN.js"></script>
<script charset="utf-8" src="kindeditor/plugins/code/prettify.js"></script>

<title>影子〃對不起</title>
<script>
	KindEditor.ready(function(K) {
	
	var editor1 = K.create('textarea[name="content"]', {
	
	cssPath : 'kindeditor/plugins/code/prettify.css',
	
	uploadJson : 'kindeditor/jsp/upload_json.jsp',
	
	fileManagerJson : 'kindeditor/jsp/file_manager_json.jsp',
	
	allowFileManager : true,
	
	afterCreate : function() {
	
	var self = this;
	
	K.ctrl(document, 13, function() {
	
	self.sync();
	
	document.forms['example'].submit();
	
	});
	
	K.ctrl(self.edit.doc, 13, function() {
	
	self.sync();
	
	document.forms['example'].submit();
	
	});
	
	}
	
	});
	
	prettyPrint();
	
	});
</script>

</head>
<body>
	<form name="example" method="post" action="writeBlog.action">
		<div style="border-top-style:groove;padding:10px;">
		文    章    标    题：
		<input  type="text" name="title">
		</div>
		
		<div style="border-top-style:groove;padding:10px;">
		文    章    分    类：
		<select name = "type">
			<option value= 0>--选择--</option>
			<option value= "程序人生">程序人生</option>
			<option value= "日志">日志</option>
			<option value= "欣赏">欣赏</option>
			<option value= "感悟生活">感悟生活</option>
		</select>
		</div>
		
		<div style="border-top-style:groove;padding:10px;">
		文    章    内    容：
		<textarea name="content" cols="150" rows="30"><%=htmlspecialchars(htmlData)%></textarea>
		<br/>
		
		<input type="submit" name="button" value="提交" />
		</div>
		(提交快捷键: Ctrl + Enter)
	</form>
</body>
</html>

<%!
private String htmlspecialchars(String str) {
  str = str.replaceAll("&", "&");
  str = str.replaceAll("<", "<");
  str = str.replaceAll(">", ">");
  str = str.replaceAll("\"", "&quot;");
  return str;
}
%>